#include "NoSmoke.h"

NoSmoke g_pNoSmoke;

void NoSmoke::Init()
{
	Active = true;
	g_pSmokeStack	  = g_pInterfaces.g_pMaterialSystem->FindMaterial(/*SmokeStack*/XorStr(10, 0xE1, 0xB20DB035, 0xB80FAF3B, 0xBA330000).c_str(),
																	  /*ClientEffect textures*/XorStr(21, 0xFE, 0xBD11951E, 0x940DBD11, 0x90109707, 0xD2059517, 0x9A189E0E, 0x99000000).c_str(), true, NULL);
	g_pSmokeParticle  = g_pInterfaces.g_pMaterialSystem->FindMaterial(/*particle/particle_smokegrenade*/XorStr(30, 0xFF, 0x8F1F8F08, 0x9219951D, 0xD8069406, 0x871B921C, 0x8A319E01, 0x84018C0F, 0x95038B05, 0x87070000).c_str(), 
																	  /*ClientEffect textures*/XorStr(21, 0xFE, 0xBD11951E, 0x940DBD11, 0x90109707, 0xD2059517, 0x9A189E0E, 0x99000000).c_str(), true, NULL);
	g_pSmokeParticle1 = g_pInterfaces.g_pMaterialSystem->FindMaterial(/*particle/particle_smokegrenade1*/XorStr(31, 0x55, 0x25B521A6, 0x38B323AB, 0x62BC2AB8, 0x3DA124AA, 0x209B30AF, 0x2EAB5AD9, 0x4FD955DB, 0x5DDD0600).c_str(),
																	  /*ClientEffect textures*/XorStr(21, 0xFE, 0xBD11951E, 0x940DBD11, 0x90109707, 0xD2059517, 0x9A189E0E, 0x99000000).c_str(), true, NULL);
	g_pScreenSpaceFog = g_pInterfaces.g_pMaterialSystem->FindMaterial(/*particle/screenspace_fog*/XorStr(24, 0x53, 0x23B323A4, 0x26AD21A9, 0x64B92ABA, 0x22A32BB7, 0x33A322A5, 0x60D852DB).c_str(), 
																	  /*ClientEffect textures*/XorStr(21, 0xFE, 0xBD11951E, 0x940DBD11, 0x90109707, 0xD2059517, 0x9A189E0E, 0x99000000).c_str(), true, NULL);
}

void NoSmoke::SetActive(bool bActive)
{
	Active = bActive;
}

void NoSmoke::Enable()
{
	Active = true;
}

void NoSmoke::Disable()
{
	Active = false;
}

void NoSmoke::Compute()
{
	if(Active)
	{
		g_pSmokeStack->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		g_pSmokeParticle->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		JUNK_CODE;
		g_pSmokeParticle1->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		g_pScreenSpaceFog->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, true);
		JUNK_CODE;
	}
	else
	{
		g_pSmokeStack->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		JUNK_CODE;
		g_pSmokeParticle->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		g_pSmokeParticle1->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
		JUNK_CODE;
		g_pScreenSpaceFog->SetMaterialVarFlag(MATERIAL_VAR_NO_DRAW, false);
	}
}